/*
    分享类（基本）
    整个shared的核心功能
*/
import { Store } from 'redux';

export default class BaseShared {
    static pool: Store;

    static actions = new Map();

    constructor(Pool: Store, action = new Map()) {
        BaseShared.pool = Pool;
        BaseShared.actions = action;
    }

    public init(listener: any): void {
        BaseShared.pool.subscribe(listener);
    }

    public dispatch(target: string, param: any = ''):any {
        const res:any = BaseShared.actions.get(target)(param);
        return res;
    }
}
